<template lang="html">
  <div class="box">
      <div class="header">
          <el-form class="filterCondition demo-form-inline" ref="form"  :inline="true" label-width="80px">
              <el-input placeholder="请输入运营商名称" v-model="keyword" style="width: 420px;">
                <el-button slot="append" style="width: 120px;" @click="search()">搜索</el-button>
              </el-input>
          </el-form>
      </div>
      <div class="body" v-loading="loading">
          <el-table :data="tableData.list" border style="width: 100%">
              <el-table-column label="运营商名称" align="center" width="">
                  <template slot-scope="scope">
                    <el-popover trigger="click" @show="getAgentDetail(scope.row)" placement="right">
                          <div v-loading="agentNameLoading">
                              <p>负责人: {{agentNameData.leader}}</p>
                              <p>电话: {{agentNameData.phone}}</p>
                              <p>注册地址: {{agentNameData.province}}-{{agentNameData.city}}-{{agentNameData.county}}-{{agentNameData.address}}</p>
                              <p>开户行: {{agentNameData.bank}}</p>
                              <p>开户账号: {{agentNameData.account}}</p>
                              <p>开户人: {{agentNameData.bank_name}}</p>
                              <p>系统开通时间: {{agentNameData.audit_time}}</p>
                          </div>

                          <div slot="reference" class="name-wrapper">
                            <!-- <el-tag size="medium">{{ scope.row.company }}</el-tag> -->
                              <el-button type="primary" size="mini" plain>{{scope.row.company}}</el-button>
                          </div>
                    </el-popover>
                  </template>
              </el-table-column>
              <el-table-column label="运营区域" align="center" width="80">
                  <template slot-scope="scope">
                    <el-button type="primary" size="mini" @click="getAgentArea(scope.row)" plain>{{scope.row.area_num}}</el-button>
                  </template>
              </el-table-column>
              <el-table-column label="业务详情" align="center">
                  <el-table-column label="售卡量" align="center"  width="150">
                      <template slot-scope="scope">
                          <el-button type="primary" size="mini" @click="agentCardInfo(scope.row,1,1)" plain>{{scope.row.sale_card}}</el-button>
                      </template>
                  </el-table-column>
                  <el-table-column label="售卡金额" align="center" width="150">
                      <template slot-scope="scope">
                          <el-button type="primary" size="mini" @click="agentCardInfo(scope.row,1,2)" plain>{{scope.row.sale_price}}</el-button>
                      </template>
                  </el-table-column>
                  <el-table-column label="保养次数" align="center" width="150">
                      <template slot-scope="scope">
                          <el-button type="primary" size="mini" plain @click="getBbytime(scope.row,1)">{{scope.row.service_time}}</el-button>
                      </template>
                  </el-table-column>
                  <el-table-column label="剩余次数" align="center" width="150">
                      <template slot-scope="scope">
                          <el-button type="primary" size="mini" plain  @click="getBbytime(scope.row,2)">{{scope.row.remain_times}}</el-button>
                      </template>
                  </el-table-column>
              </el-table-column>
              <el-table-column label="维修厂数量" align="center" width="150">
                  <template slot-scope="scope">
                    <el-button type="primary" size="mini" plain @click="getSShopList(scope.row)">{{scope.row.shop_num}}</el-button>
                  </template>
              </el-table-column>
              <el-table-column label="关停次数" align="center" width="150">
                  <template slot-scope="scope">
                      <el-popover  placement="left-start" width="800" @show="agentStopList(scope.row)" trigger="click">
                          <el-table :data="agentStopListData">
                              <el-table-column width="" align="center" label="关停理由">
                                  <template slot-scope="scope">
                                      <p v-if="scope.row.status==0">{{scope.row.reason}}</p>
                                      <p v-if="scope.row.status==1">--</p>
                                  </template>
                              </el-table-column>
                              <el-table-column width="" align="center" label="关停时间">
                                  <template slot-scope="scope">
                                      <p v-if="scope.row.status==0">{{scope.row.create_time}}</p>
                                      <p v-if="scope.row.status==1">--</p>
                                  </template>
                              </el-table-column>
                              <el-table-column width="" align="center" label="开通理由">
                                  <template slot-scope="scope">
                                      <p v-if="scope.row.status==0">--</p>
                                      <p v-if="scope.row.status==1">{{scope.row.reason}}</p>
                                  </template>
                              </el-table-column>
                              <el-table-column width="" align="center" label="开通时间">
                                  <template slot-scope="scope">
                                      <p v-if="scope.row.status==0">--</p>
                                      <p v-if="scope.row.status==1">{{scope.row.create_time}}</p>
                                  </template>
                              </el-table-column>
                          </el-table>
                          <el-button type="primary" size="mini" plain slot="reference">{{scope.row.cancel_num}}</el-button>
                      </el-popover>
                  </template>
              </el-table-column>
              <el-table-column label="投诉次数" align="center" width="150">
                    <template slot-scope="scope">
                        <el-popover  placement="left" width="800" @show="agentComplain(scope.row)" trigger="click">
                            <el-table :data="agentComplainData.list">
                                <el-table-column width="" align="center" property="company" label="投诉人"></el-table-column>
                                <el-table-column width="" align="center" property="title" label="投诉理由"></el-table-column>
                                <el-table-column width="" align="center" property="create_time" label="投诉时间"></el-table-column>
                                <el-table-column width="" align="center" property="status" label="处理状态">
                                    <!-- <template slot-scope="scope">
                                        <p v-if="scope.row.status==0">--</p>
                                        <p v-if="scope.row.status==1">{{scope.row.create_time}}</p>
                                    </template> -->
                                </el-table-column>
                                <el-table-column width="" align="center" property="audit_time" label="处理时间"></el-table-column>
                            </el-table>

                            <div class="page_box">
                                <el-pagination class="page" layout="prev, pager, next"
                                  @current-change="onpage3(scope.row,currentPage3)" :current-page="currentPage3" :page-count='agentComplainData.rows' >
                                </el-pagination>
                            </div>
                            <el-button type="primary" size="mini" plain slot="reference">{{scope.row.complain_num}}</el-button>
                        </el-popover>
                    </template>
              </el-table-column>
              <el-table-column  label="状态" align="center" width="">
                <template slot-scope="scope">
                    <p v-if="scope.row.status == 2">正常</p>
                    <p v-if="scope.row.status == 3">未选择地区</p>
                    <p v-if="scope.row.status == 4">已选择地区</p>
                    <p v-if="scope.row.status == 5">地区被驳回</p>
                    <p v-if="scope.row.status == 6">已取消合作</p>
                    <p v-if="scope.row.status == 7">总后台关停</p>
                    <p v-if="scope.row.status == 8">投诉关停</p>
                </template>
              </el-table-column>
              <el-table-column  label="操作" align="center" width="">
                <template slot-scope="scope">
                    <el-button v-if="scope.row.status == 2" type="text" size="mini" @click="doShutdown(scope.row)">关停</el-button>
                    <el-button v-if="scope.row.status == 7 || scope.row.status == 8" type="text" size="mini" @click="doStart(scope.row)">再次开通</el-button>
                </template>
              </el-table-column>
          </el-table>
      </div>
      <div class="page_box">
          <el-pagination class="page" layout="prev, pager, next"
            @current-change="switchPage" :current-page="currentPage1" :page-count='tableData.rows' >
          </el-pagination>
      </div>

        <!--  -->
        <el-dialog :visible.sync="dialogVisible" width="800px">
            <el-table :data="bytimeDetailData.list">
                <el-table-column width="" align="center" property="card_number" label="邦保养卡号"></el-table-column>
                <el-table-column width="" align="center" label="卡类型">
                    <template slot-scope="scope">
                        <p v-if="scope.row.card_type == 1">单次体验</p>
                        <p v-if="scope.row.card_type == 4">四次套餐</p>
                    </template>
                </el-table-column>
                <el-table-column width="" align="center" property="plate" label="车牌号"></el-table-column>
                <el-table-column width="" align="center"  label="车型">
                    <template slot-scope="scope">
                        <el-popover trigger="hover" placement="top">
                            <p>{{ scope.row.car_brand }}--{{ scope.row.car_type }}</p>
                            <div slot="reference" class="name-wrapper">
                              <el-tag size="mini">{{ scope.row.car_type }}</el-tag>
                            </div>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column width="" align="center" property="oil_name" label="保养用油"></el-table-column>
                <el-table-column width="80" align="center" property="service_time" label="保养次数"></el-table-column>
            </el-table>

            <div class="page_box">
                <el-pagination class="page" layout="prev, pager, next"
                  @current-change="onpage2(scope.row,currentPage2)" :current-page="currentPage2" :page-count='bytimeDetailData.rows' >
                </el-pagination>
            </div>
        </el-dialog>
        <!--  -->
        <!--  -->
        <el-dialog :visible.sync="dialogVisible2" width="800px">
            <el-table :data="bytimeDetailData.list">
                <el-table-column width="" align="center" property="card_number" label="邦保养卡号"></el-table-column>
                <el-table-column width="" align="center" label="卡类型">
                    <template slot-scope="scope">
                        <p v-if="scope.row.card_type == 1">单次体验</p>
                        <p v-if="scope.row.card_type == 4">四次套餐</p>
                    </template>
                </el-table-column>
                <el-table-column width="" align="center" property="plate" label="车牌号"></el-table-column>
                <el-table-column width="" align="center"  label="车型">
                    <template slot-scope="scope">
                        <el-popover trigger="hover" placement="top">
                            <p>{{ scope.row.car_brand }}--{{ scope.row.car_type }}</p>
                            <div slot="reference" class="name-wrapper">
                              <el-tag size="medium">{{ scope.row.car_type }}</el-tag>
                            </div>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column width="" align="center" property="oil_name" label="保养用油"></el-table-column>
                <el-table-column width="80" align="center" property="service_time" label="保养次数"></el-table-column>
                <el-table-column width="80" align="center" property="remain_times" label="剩余次数"></el-table-column>
            </el-table>

            <div class="page_box">
                <el-pagination class="page" layout="prev, pager, next"
                  @current-change="onpage2(scope.row,currentPage2)" :current-page="currentPage2" :page-count='bytimeDetailData.rows' >
                </el-pagination>
            </div>
        </el-dialog>
        <!--  -->
        <el-dialog :visible.sync="dialogVisible3" width="400px">
          <el-table :data="agentAreaData" v-loading="!agentAreaData.length">
              <el-table-column width="" align="center" label="省市县/区显示">
                  <template slot-scope="scope">
                    <!-- <div v-if="scope.row.area_name.city"> -->
                        <p v-for="(item,k) in scope.row.area_name" :key="k" v-if="item">{{item.city}}-{{item.county}}</p>
                    <!-- </div> -->
                  </template>
              </el-table-column>
              <el-table-column width="" align="center" label="支付凭证">
                  <template slot-scope="scope">
                      <img :src="scope.row.voucher" :preview="scope.row.voucher" class="preview-img" alt="">
                  </template>
              </el-table-column>
          </el-table>
        </el-dialog>
        <!--  -->
        <el-dialog :visible.sync="dialogVisible4" width="60%">
          <div class="">
              <el-table :data="quantityData.list">
                  <el-table-column width="" align="center" property="card_number" label="邦保养卡号"></el-table-column>
                  <el-table-column width="100" align="center" label="卡类型">
                        <template slot-scope="scope">
                            <p v-if="scope.row.card_type == 1">单次体验</p>
                            <p v-if="scope.row.card_type == 4">四次套餐</p>
                        </template>
                  </el-table-column>
                  <el-table-column width="100" align="center" property="name" label="车主姓名"></el-table-column>
                  <el-table-column width="" align="center" property="phone" label="车主电话"></el-table-column>
                  <el-table-column width="" align="center" property="plate" label="车牌号"></el-table-column>
                  <el-table-column width="" align="center" label="车型">
                        <template slot-scope="scope">
                            <el-popover trigger="hover" placement="top">
                                <p>{{ scope.row.car_brand }}--{{ scope.row.car_type }}</p>
                                <div slot="reference" class="name-wrapper">
                                  <el-tag size="mini">{{ scope.row.car_type }}</el-tag>
                                </div>
                            </el-popover>
                        </template>
                  </el-table-column>
                  <el-table-column align="center" property="sale_time" label="售卡时间"></el-table-column>
              </el-table>
              <div class="page_box">
                <el-pagination class="page" layout="prev, pager, next"
                  @current-change="quantityDatapage" :page-count='quantityData.rows' >
                </el-pagination>
              </div>
          </div>
        </el-dialog>
        <!--  -->
        <el-dialog :visible.sync="dialogVisible5" width="60%">
          <div class="">
              <el-table :data="quantityData.list">
                  <el-table-column width="" align="center" property="card_number" label="邦保养卡号"></el-table-column>
                  <el-table-column width="100" align="center" label="卡类型">
                        <template slot-scope="scope">
                            <p v-if="scope.row.card_type == 1">单次体验</p>
                            <p v-if="scope.row.card_type == 4">四次套餐</p>
                        </template>
                  </el-table-column>
                  <el-table-column width="100" align="center" property="name" label="车主姓名"></el-table-column>
                  <el-table-column width="" align="center" property="phone" label="车主电话"></el-table-column>
                  <el-table-column width="" align="center" property="plate" label="车牌号"></el-table-column>
                  <el-table-column width="" align="center" label="车型">
                        <template slot-scope="scope">
                            <el-popover trigger="hover" placement="top">
                                <p>{{ scope.row.car_brand }}--{{ scope.row.car_type }}</p>
                                <div slot="reference" class="name-wrapper">
                                  <el-tag size="mini">{{ scope.row.car_type }}</el-tag>
                                </div>
                            </el-popover>
                        </template>
                  </el-table-column>
                  <el-table-column width="" align="center" property="card_price" label="售卡金额"></el-table-column>
                  <el-table-column width="" align="center" property="sale_time" label="售卡时间"></el-table-column>
              </el-table>
              <div class="page_box">
                <el-pagination class="page" layout="prev, pager, next"
                  @current-change="quantityDatapage" :page-count='quantityData.rows' >
                </el-pagination>
              </div>
          </div>
        </el-dialog>
        <!--  -->
        <el-dialog :visible.sync="dialogVisible6">
          <div class="">
              <el-table :data="bytimeData.list">
                  <el-table-column width="" align="center" property="company" label="维修厂"></el-table-column>
                  <el-table-column width="" align="center" property="leader" label="负责人"></el-table-column>
                  <el-table-column width="" align="center" label="地区">
                      <template slot-scope="scope">
                          <p>{{scope.row.province}}-{{scope.row.city}}-{{scope.row.county}}</p>
                      </template>
                  </el-table-column>
                  <el-table-column width="" align="center" label="保养次数">
                      <template slot-scope="scope">
                          <el-button type="primary" @click="doShow(scope.row)" size="mini" plain slot="reference">{{scope.row.service_num}}</el-button>
                      </template>
                  </el-table-column>
                  <el-table-column width="" align="center" property="remain_times" label="剩余次数">
                      <template slot-scope="scope">
                          <el-button type="primary" @click="doClose(scope.row)" size="mini" plain slot="reference">{{scope.row.remain_times}}</el-button>
                      </template>
                  </el-table-column>
              </el-table>
              <div class="page_box">
                <el-pagination class="page" layout="prev, pager, next"
                  @current-change="bytimeDatapage" :page-count='bytimeData.rows' >
                </el-pagination>
              </div>
          </div>
        </el-dialog>
        <!--  -->
        <el-dialog :visible.sync="dialogVisible7">
          <div class="">
              <el-table :data="bytimeData.list">
                  <el-table-column width="" align="center" property="company" label="维修厂名称"></el-table-column>
                  <el-table-column width="" align="center" property="leader" label="负责人"></el-table-column>
                  <el-table-column width="" align="center" label="地区">
                    <template slot-scope="scope">
                        <p>{{scope.row.province}}-{{scope.row.city}}-{{scope.row.county}}</p>
                    </template>
                  </el-table-column>
                  <el-table-column width="" align="center" property="remain_times" label="剩余保养次数">
                      <template slot-scope="scope">
                          <el-button type="primary" @click="doShow(scope.row)" size="mini" plain slot="reference">{{scope.row.remain_times}}</el-button>
                      </template>
                  </el-table-column>
              </el-table>
              <div class="page_box">
                <el-pagination class="page" layout="prev, pager, next"
                  @current-change="bytimeDatapage" :page-count='bytimeData.rows' >
                </el-pagination>
              </div>
          </div>
        </el-dialog>
        <!--  -->
        <el-dialog :visible.sync="dialogVisible8">
          <div class="">
            <el-table :data="shopListData.list" v-loading="!shopListData.list">
                <el-table-column width="" align="center" property="company" label="维修厂名称"></el-table-column>
                <el-table-column width="" align="center" property="leader" label="负责人"></el-table-column>
                <el-table-column width="" align="center" property="phone" label="电话"></el-table-column>
                <el-table-column width="" align="center" label="地区">
                      <template slot-scope="scope">
                        <!-- <el-popover trigger="hover" placement="top"> -->
                            <p>{{ scope.row.city }}-{{ scope.row.county }}</p>
                            <!-- <div slot="reference" class="name-wrapper">
                              <el-tag size="medium">{{ scope.row.city }}</el-tag>
                            </div>
                        </el-popover> -->
                      </template>
                </el-table-column>
                <el-table-column width="" align="center" label="售卡数量">
                    <template slot-scope="scope">
                        <el-popover  placement="left" width="1000" @show="getShopCardList(scope.row)" trigger="click">
                              <el-table :data="shopCardData.list">
                                  <el-table-column width="" align="center" property="card_number" label="卡号"></el-table-column>
                                  <el-table-column width="100" align="center" property="shop_name" label="卡类型">
                                        <template slot-scope="scope">
                                            <p v-if="scope.row.card_type == 1">单次体验</p>
                                            <p v-if="scope.row.card_type == 4">四次套餐</p>
                                        </template>
                                  </el-table-column>
                                  <el-table-column width="100" align="center" property="user_name" label="车主姓名"></el-table-column>
                                  <el-table-column width="" align="center" property="plate" label="车牌号"></el-table-column>
                                  <el-table-column width="" align="center" label="车辆类型">
                                      <template slot-scope="scope">
                                          <el-popover trigger="hover" placement="top">
                                              <p>{{ scope.row.car_type }}-{{ scope.row.car_brand }}</p>
                                              <el-button type="primary" size="mini" plain slot="reference">{{scope.row.car_type}}</el-button>
                                          </el-popover>
                                      </template>
                                  </el-table-column>
                                  <el-table-column width="" align="center" property="sale_time" label="购卡时间"></el-table-column>
                                  <el-table-column width="" align="center" property="card_price" label="购卡金额"></el-table-column>
                              </el-table>

                              <div class="page_box">
                                  <el-pagination class="page" layout="prev, pager, next"
                                    @current-change="onpage5(scope.row,currentPage5)" :current-page.sync="currentPage5" :page-count='shopCardData.rows' >
                                  </el-pagination>
                              </div>
                              <el-button type="primary" size="mini" plain slot="reference">{{scope.row.card_sale_num}}</el-button>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column width="" align="center" property="" label="技师">
                    <template slot-scope="scope">
                      <el-popover  placement="left" width="800" @show="getShopWorkList(scope.row)" trigger="click">
                            <el-table :data="shopWorkData.list">
                                <el-table-column width="" align="center" property="card_number" label="姓名"></el-table-column>
                                <el-table-column width="" align="center" property="phone" label="电话"></el-table-column>
                                <el-table-column width="" align="center" property="server" label="从业时间"></el-table-column>
                                <el-table-column width="" align="center" property="plate" label="邦保养奖励金">
                                      <template slot-scope="scope">
                                          <p v-if="scope.row.reward == null">0</p>
                                          <p v-else>{{scope.row.reward}}</p>
                                      </template>
                                </el-table-column>
                                <el-table-column width="" align="center" label="换店记录">
                                    <template slot-scope="scope">
                                        <el-popover trigger="hover" placement="top">
                                            <p v-if="scope.row.changeShop.length == 0">暂无记录</p>
                                            <div v-else>
                                              <div v-for="i in scope.row.changeShop">
                                                  <p>修理厂名称：{{i.company}}</p>
                                                  <p>换店理由：{{i.reason}}</p>
                                                  <p>申请时间：{{i.create_time}}</p>
                                                  <p>审核时间：{{i.audit_time}}</p>
                                              </div>
                                            </div>
                                            <el-button type="primary" size="mini" plain slot="reference">{{scope.row.changeShop.length}}</el-button>
                                        </el-popover>
                                    </template>
                                </el-table-column>
                            </el-table>

                            <div class="page_box">
                                <el-pagination class="page" layout="prev, pager, next"
                                  @current-change="onpage6(scope.row,currentPage6)" :current-page.sync="currentPage6" :page-count='shopWorkData.rows' >
                                </el-pagination>
                            </div>
                            <el-button type="primary" size="mini" plain slot="reference">{{scope.row.tech_num}}</el-button>
                      </el-popover>
                    </template>
                </el-table-column>
                <el-table-column width="" align="center" property="audit_time" label="开通时间"></el-table-column>
            </el-table>
            <div class="page_box">
                <el-pagination class="page" layout="prev, pager, next"
                  @current-change="onpage4" :page-count='shopListData.rows' >
                </el-pagination>
            </div>
          </div>
        </el-dialog>

  </div>
</template>

<script>
export default {
  data(){
    return {
      token: this.$store.state.user.token3,
      // 所有数据
      tableData: [],
      //运营商名称
      agentNameData: [],
      // 运营区域
      agentAreaData: [],
      // 售卡量和售卡金额
      quantityData: [],
      // 保养次数或剩余次数
      bytimeDetailData: [],
      bytimeData: [],
      agentStopListData: [],
      agentComplainData: [],
      shopListData: [],
      shopCardData: [],
      shopWorkData: [],
      keyword: '',
      loading: false,
      dialogVisible:false,
      dialogVisible2:false,
      dialogVisible3:false,
      dialogVisible4:false,
      dialogVisible5:false,
      dialogVisible6:false,
      dialogVisible7:false,
      dialogVisible8:false,
      agentNameLoading: false,
      currentPage5:1,
      currentPage6:1,
      currentPage4:1,
      currentPage3:1,
      currentPage2:1,
      currentPage1:1,
      currentPage:1,
      firstCurRow: {},
      childCurRow: {},

    }
  },
  created (){
    this.getAgentList()
    this.$preview.on('imageLoadComplete',(e,item)=>{
    	this.$preview.self.template.style.zIndex = 99999
    })
  },
  methods:{
    search(){
        if(this.loading)
        return false;
        this.getAgentList()
    },
    getAgentList(page = 1){
        this.loading = true;
        this.currentPage1 = page;
        this.$http3.agentList({
          token: this.token,
          page: page,
          key: this.keyword
        }).
        then(res=>{
          this.tableData =
          res.data.code == 1?
          res.data.data: [];
          this.loading = false
        })
    },
    // 关停操作
    doShutdown(e){
        this.$prompt('请输入关停理由','关停操作').then(({value})=>{
          this.$http3.agentStop({
            token:this.token,
            aid:e.aid,
            company: e.company,
            leader: e.leader,
            reason: value,
          }).then(res=>{
            if(res.data.code==1){
              this.$message.success(res.data.msg)
              this.getAgentList()
            }else{
              this.$message.error(res.data.msg)
            }
          })
        }).catch(_=>{});

    },
    // 再次开通
    doStart(e){
      this.$prompt('请输入开通理由','开通操作').then(({value})=>{
        this.$http3.agentStart({
          token:this.token,
          aid:e.aid,
          company: e.company,
          leader: e.leader,
          reason: value,
        }).then(res=>{
          if(res.data.code==1){
            this.$message.success(res.data.msg)
            this.getAgentList()
          }else{
            this.$message.error(res.data.msg)
          }
        })
      }).catch(_=>{});
    },
    // 点击运营商名称
    getAgentDetail(e){
      this.agentNameData = []
      this.agentNameLoading = true
      this.$http3.getAgentDetail({
        aid: e.aid
      }).then(res=>{
        this.agentNameLoading = false
        this.agentNameData =
        res.data.code == 1?
        res.data.data: []
      })
    },
    // 获取运营区域
    getAgentArea(e){
      this.dialogVisible3 = true;
      this.agentAreaData = []
      this.$http3.getAgentArea({
        token: this.token,
        aid: e.aid
      }).then(res=>{
        this.agentAreaData =
        res.data.code == 1?
        res.data.data: []
        this.$previewRefresh()
      })
    },
    // 售卡量和售卡金额
    agentCardInfo(e,page = 1,n){
      if(n == 1){
        this.dialogVisible4 = true;
      }else{
        this.dialogVisible5 = true;
      }
      this.quantityData = [];
      this.firstCurRow = e;
      this.firstCurRow.n = n;
      this.$http3.agentCardInfo({
        aid: this.firstCurRow.aid,
        page: page,
        token: this.token
      }).then(res=>{
        this.quantityData =
        res.data.code == 1?
        res.data.data: []
      })
    },
    quantityDatapage(p){
      this.agentCardInfo(this.firstCurRow,p,this.firstCurRow.n)
    },
    // 点击保养次数或剩余次数后调用
    getBbytime(e,n,page=1){
      if(n == 1){
        this.dialogVisible6 = true;
      }else{
        this.dialogVisible7 = true;
      }
      this.bytimeData = []
      this.firstCurRow = e;
      this.firstCurRow.n = n;
      this.$http3.getBbytime({
        token: this.token,
        aid: this.firstCurRow.aid,
        page:page
      }).then(res=>{
        this.bytimeData =
        res.data.code == 1?
        res.data.data:[]
      })
    },
    bytimeDatapage(p){
      this.getBbytime(this.firstCurRow,this.firstCurRow.n,p)
    },
    // 维修厂数量
    getSShopList(e,page=1){
      this.dialogVisible8 = true;
      this.firstCurRow = e;
      this.shopListData = []
      this.$http3.getSShopList({
        token: this.token,
        aid: this.firstCurRow.aid,
        page: page
      }).then(res=>{
        this.shopListData =
        res.data.code == 1?
        res.data.data:[]
      })
    },
    onpage4(p){
      this.getSShopList(this.firstCurRow,p)
    },
    // -维修厂数量-售卡数量
    getShopCardList(e,page=1){
      this.shopCardData = []
      this.$http3.getShopCardList({
        sid: e.sid,
        page:page
      }).then(res=>{
        this.shopCardData =
        res.data.code == 1?
        res.data.data:[]
      })
    },
    onpage5(e,p){
      this.getShopCardList(e,p)
    },
    getShopWorkList(e){
      this.shopWorkData = []
      this.$http3.getShopWorkList({
        sid: e.sid
      }).then(res=>{
        this.shopWorkData =
        res.data.code == 1?
        res.data.data:[]
      })
    },
    onpage6(e,p){
      this.getShopWorkList(e,p)
    },
    doShow(e){
      this.dialogVisible = true;
      this.currentPage2 = 1;
      this.getBbytimeDetail(e)
    },
    doClose(e){
      this.dialogVisible2 = true;
      this.currentPage2 = 1;
      this.getBbytimeDetail(e)
    },
    // 业务详情-保养次数-保养次数
    getBbytimeDetail(e,page=1){
      this.bytimeDetailData = []
      this.$http3.getBbytimeDetail({
        token: this.token,
        sid: e.sid,
        page: page
      }).then(res=>{
        this.bytimeDetailData =
        res.data.code == 1?
        res.data.data: []
      })
    },
    onpage2(e,p){
      this.getBbytimeDetail(e,p)
    },
    // 关停次数
    agentStopList(e){
      this.agentStopListData = []
      this.$http3.agentStopList({
        token: this.token,
        aid: e.aid
      }).then(res=>{
        this.agentStopListData =
        res.data.code == 1?
        res.data.data:[]
      })
    },
    // 投诉次数
    agentComplain(e,page=1){
      this.agentComplainData =[]
      this.currentPage3 = page;
      this.$http3.agentComplain({
        token: this.token,
        aid: e.aid,
        page: page
      }).then(res=>{
        this.agentComplainData =
        res.data.code == 1?
        res.data.data:[]
      })
    },
    onpage3(e,p){
      this.agentComplain(e,p)
    },
    onpage(e,p){
      this.agentCardInfo(e,p)
    },
    // 分页
    switchPage(e){
        this.getAgentList(e)
    },

  }

}
</script>

<style lang="css" scoped>
@import "../../my-style/app.css";
/deep/ .el-input-group__append, .el-input-group__prepend{
  background-color: #3498E9;
  border: none;
  color: white;
}
.preview-img{
  display: block;
  width: 100%;
  height: 30px;
}
.header{
  margin-bottom: 10px
}
.page_box{
  text-align: center;
}
.cell button{
  margin-right: auto
}
</style>
